var PanelLogin = _Panel.extend(
{
	AttemptLogin: function(data, mySelf)
	{
		chat.getClsSession().check(data['username'], data['password']);
		
	},
	
	initialize: function(main)
	{
		this.parent();
		this.main = main;
		
		// Design the login form
		var form = FormInst.CreateForm('login', main);
		
		FormInst.OnSubmit(form, this.AttemptLogin, this);
		
		FormInst.CreateInput(form, 'username', 'Username', 'Hans');
		FormInst.CreateInputP(form, 'password', 'Password', 'testen');
		FormInst.CreateSubmit(form, 'Login!');
		
		// Set window settings
		this.WindowID = 'site_login';
		
		this.WindowTitle = 'Login';
		
		this.WindowContents = 
			'Welcome to the online chatbox and messenger!<br />If you\'ve an ID already, please login here:<br /><div class="error_box" id="site_login_error"></div>' +
			FormInst.GenerateHTML(form)
			+ '<br />If you haven\'t registrered yet, please do so: <a href="javascript:Register_open();">click here to register</a>';
		
		this.WindowLoc = ['center', 'center'];
		this.WindowLocFixed = false;
		
		this.WindowSizeFixed = true;
		this.WindowSize = {x: 300, y: -1};
		
		this.WindowCloseByUser = false;
		
		this.WindowOnTop = false;
		
		this.WindowStyle = "";
		
	} // end function initialize
	
});

Register_open = function()
{
	chat.showRegister();
	
};

cimport_loaded('panels.Site.Login');
